var app = new Vue({
	el: '#app',
	extends: isLogin,
	components:{
		navs:nav,
		footers:footer,
		login:login,
	},
	data: {
		bgImg:'img/PCindex/top5.jpg',
		navState:'求职招聘',
		jobDetailData: '', //工作详情数据
		recommendData: '', //本公司职位推荐数据
		PageIndex:1,//当前页数
		PageSize:5,//获取数量
		selfRecJob:'',//本职位推荐数据
	},
	methods: {
		//获取工作详情数据
		jobDetail: function() {
			var _this = this;
			var jobId = localStorage.getItem('JobID');
			var method = 'HR/GetDetailPosi';
			var param = {
				KeyId: jobId
			};
			xq.getUrl(method, param, function(res) {
				if(res.data) {
					var data = res.data;
					var OtherWelfare = [];
					_this.selfRecommendJob(data.JobCategory);
					_this.recommendJob(data.EntName,data.JobCategory,data.Workplace);
					if(data.OtherWelfare){
						OtherWelfare = data.OtherWelfare.split(',');
					}
					data.CreateDate = xq.getYMDHM(data.CreateDate, 'yy/mm/dd');
					data.OtherWelfare = OtherWelfare;
					_this.jobDetailData = data;
				}
			});
		},
//		//获取本职位推荐数据
		selfRecommendJob: function(JobCategory) {
			var _this = this;
//			var jobId = localStorage.getItem('JobID');
			var method = 'HR/SearchPosi';
			var param = {
				Keyword: '' ,//”职位名称或公司名称”,
				JobCategory: JobCategory ,//” 职务分类”,
				Workplace: '' ,//“工资地点”
				Salary: '' ,//“ 薪酬”
				PageSize: _this.PageSize,//” 获取数量”,
				PageIndex: _this.PageIndex,//“ 当前页数”,
			};
			xq.getUrl(method, param, function(res) {
				if(res.data) {
					_this.selfRecJob = res.data.ListEntity;
				}
			});
		},
		//获取该公司职位推荐数据
		recommendJob: function(EntName,JobCategory,Workplace) {
			var _this = this;
//			var jobId = localStorage.getItem('JobID');
			var method = 'HR/SearchPosi';
			var param = {
				Keyword: EntName ,//”职位名称或公司名称”,
				JobCategory: JobCategory ,//” 职务分类”,
				Workplace: Workplace ,//“公司地点”
				Salary: '' ,//“ 薪酬”
				PageSize: _this.PageSize,//"获取数量”,
				PageIndex: _this.PageIndex,//“ 当前页数”,
			};
			xq.getUrl(method, param, function(res) {
				if(res.data) {
					_this.recommendData = res.data.ListEntity;
				}
			});
		},
		//点击职位推荐职位
		clickCompanyJob:function(JobID){
			localStorage.setItem('JobID',JobID);
			location.href = 'recruitDetail.html';
		}

	},
	mounted: function() {
		this.jobDetail();
	},
	updated: function() {

	}
})